#!/bin/ksh

# mac, bash 不能按照预期输出，ksh 好点，但是遍历的时候居然自己就排序了key

monDic=([January]=31 
[February]=28 
[March]=31 
[April]=30 
[May]=31 
[June]=30 
[July]=31 
[August]=31 
[September]=30 
[October]=31 
[November]=30 
[December]=31)

echo ""
echo "元素个数为: ${#monDic[*]}"

echo ""
echo "整体输出:"${monDic[@]}

# 循环下标遍历
echo ""
echo 循环下标遍历
echo ${!monDic[@]}
echo ${!monDic[*]}
loop=0
for key in ${!monDic[@]}
do
	echo index:$key value:${monDic[$key]}
    
    # 按递增下标遍历 无效
    echo loop:$loop value:${monDic[$loop]}
    loop=$((loop+1))
done

let monDic[February]=${monDic[February]}+1
echo after +1, February:${monDic[February]}